﻿<cfsilent>
	<cfscript>
		
		sessionAdvice = getProperty("serviceFactory").getBean("sessionAdvice");
		
		timeAdvice = getProperty("serviceFactory").getBean("datetimeAdvice");
		dictAdvice = getProperty("serviceFactory").getBean("senateDictionaryAdvice");
		
		taskProp = getProperty("serviceFactory").getBean("taskPropertyAdvice");
		chooseProp = getProperty("serviceFactory").getBean("choosePropertyAdvice");
		
		taskId = event.getArg("TSK");
		taskType = event.getArg("TT");
		termId = event.getArg("TermID", event.getArg("TID"));

		/* 选课数据 */
		sql = "SELECT 
					t_student.stu_id, 
					t_student.stu_name, 
					t_class.cls_name, 
					t_class.grade, 
					t_institute.institute_short, 
					t_student_course.st, 
					t_student_course.choose_time, 
					t_student_course.retaking, 
					t_student_course.choose_prop, 
					t_student_course.scc_id, 
					t_student_course.cid, 
					t_student_course.task_type, 
					t_student_course.task_id 
				FROM 
					t_student_course 
					INNER JOIN t_student ON t_student.stu_id = t_student_course.stu_id 
					INNER JOIN t_class ON t_class.cls_id = t_student.cls_id 
					INNER JOIN t_subject ON t_subject.sbj_id = t_class.sbj_id 
					INNER JOIN t_institute ON t_institute.institute_id = t_subject.institute_id 
				WHERE 
					t_student_course.task_id = :taskId 
				ORDER BY 
					t_student.stu_id ";
		queryObj = new query( datasource=application.dnsSlave );
		queryObj.addParam( name="taskId", value=taskId, cfsqltype="cf_sql_varchar" );
		rs_chooser = queryObj.execute( sql=sql ).getResult();
	
		switch(taskType){
			case "C":
				sql = "SELECT task_prop 
						FROM t_common_task 
						WHERE tsk_id = :taskId ";
				break;

			case "P":
				sql = "SELECT task_prop 
						FROM t_task 
						WHERE tsk_id = :taskId ";
				break;
			
			case "R":
				sql = "SELECT task_prop 
						FROM t_reopen_task 
						WHERE tsk_id = :taskId ";
				break;
			
			case "T":
				sql = "SELECT task_prop 
						FROM t_sport_task  
						WHERE tsk_id = :taskId ";
				break;
		}
		queryObj = new query( datasource=application.dnsSlave );
		queryObj.addParam( name="taskId", value=taskId, cfsqltype="cf_sql_varchar" );
		rs_task = queryObj.execute( sql=sql ).getResult();
	
		taskProp.parseProperty( rs_task.task_prop );
		
	</cfscript>
</cfsilent>

<table class="UIEditable">
	<thead>
		<tr>
			<td width="30"></td>
			<td>学号</td>
			<td>姓名</td>
			<td>班级</td>
			<td width="35">年级</td>
			<td width="50">学院</td>
			<td width="50">修读方式</td>
			<td width="75">选课时间</td>
			<td width="60">学费状态</td>
			<td width="18"></td>
		</tr>
	</thead>
	<tbody>
		<cfset row = 0 />
		
        <cfloop query="rs_chooser">
			<cfset row ++ />
			<cfset chooseProp.parseProperty( rs_chooser.choose_prop ) />
			<tr class="editRows <cfif rs_chooser.retaking eq "1">noticeRow1</cfif>">
				<td><span class="index"><cfoutput>#row#</cfoutput></span></td>
				<td><span class="numeric"><cfoutput>#rs_chooser.stu_id#</cfoutput></span></td>
				<td><cfoutput>#rs_chooser.stu_name#</cfoutput></td>
				<td><cfoutput>#rs_chooser.cls_name#</cfoutput></td>
				<td><span class="numeric"><cfoutput>#rs_chooser.grade#</cfoutput></span></td>
				<td><cfoutput>#rs_chooser.institute_short#</cfoutput></td>
				<td><cfoutput>#dictAdvice.getStudyType(rs_chooser.st)#</cfoutput></td>
				<td><span class="numeric"><cfoutput>#timeAdvice.formatDatetimeString(rs_chooser.choose_time, 'MM/DD HH:MI')#</cfoutput></span></td>
				<td>
					<cfif chooseProp.getPrePaid()>预收
						<cfelseif chooseProp.getPaid()>已缴清
						<cfelse>未交
					</cfif>
				</td>
				<td>
					<cfif taskProp.getDischarge()>
						<span title="该教学班禁止退课" class="stat locked"></span>
						<cfelse>
						<a title="撤销课程" class="stat delete" href="javascript:removeTask('<cfoutput>#rs_chooser.scc_id#</cfoutput>','<cfoutput>#rs_chooser.cid#</cfoutput>','<cfoutput>#rs_chooser.stu_id#</cfoutput>','<cfoutput>#termId#</cfoutput>','<cfoutput>#rs_chooser.task_type#</cfoutput>','<cfoutput>#rs_chooser.task_id#</cfoutput>');"></a>
					</cfif>
				</td>
			</tr>
		</cfloop>
		<!--- javascript:removeTask(chooserId, courseId, stuId, termId, taskType, taskId); --->
	</tbody>
</table>